<?php echo $header; ?>
<?php echo $sidebar; ?>		

<div class="span10 content">

    <?php echo $hugemenu; ?>

    <h1><?php echo lang('payments'); ?></h1>

    <?php if ($this->session->flashdata('message')): ?>
        <div class="alert alert-block alert-success">
            <button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button>
            <p><?= $this->session->flashdata('message') ?></p>
        </div>
    <?php endif; ?>

    <div class="widget">
        <div class="widget-head">
            <h3 class="heading"><?php echo lang('add'); ?> <?php echo lang('membership'); ?></h3>
        </div>

        <div class="widget-body">

            <form class="form-horizontal" role="form" action="<?= site_url('admin_payments/new_payment'); ?>" method="post">

                <div class="control-group">
                    <label class="control-label" for="form-field-1"><?= lang('user') ?></label>
                    <div class="controls">
                        <div class="input-append">
                            <input type="text" class="span12" name="user" required="required" placeholder="<?= lang('username') ?>"  autocomplete="off" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source='[<?php
                            $query = $this->db->get('users');
                            if ($query->num_rows() > 0) {
                                foreach ($query->result() as $row) {
                                    echo '"' . $row->username . '",';
                                }
                            }
                            ?>"null"]'>
                            <span class="add-on"><i class="icon-user"></i></span>
                        </div>
                        <span class="help-inline" style="margin-left: 30px;"><?= lang('start_typing_username') ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="form-field-1"><?= lang('membership') ?></label>
                    <div class="controls">
                        <div class="input-append">
                            <select name="membership" class="span12" required="required">
                                <?php
                                $memberships = $this->payments_m->memberships();
                                ?>
                                <?php foreach ($memberships as $membership): ?>
                                    <option value="<?= $membership['m_id']; ?>"><?= $membership['membership'] ?> - <?= $this->settings_m->get_by('key', 'currency')->value; ?><?= $membership['amount'] ?></option>
                                <?php endforeach ?>
                            </select>
                        </div>
                        <span class="help-inline">Select a Membership Package</span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="form-field-1"><?= lang('sender') ?></label>
                    <div class="controls">
                        <div class="input-append">
                            <input type="email" name="sender" required="required" id="form-field-1" class="span12" placeholder="sample@yourdomain.com">
                            <span class="add-on"><i class="icon-exchange"></i></span>
                        </div>
                        <span class="help-inline" style="margin-left: 30px;">The email that sent the money</span>
                    </div>
                </div>

                <div class="form-actions">
                    <button class="btn btn-info" type="submit"><i class="icon-ok"></i> <?= lang('submit') ?></button>
                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset"><i class="icon-undo"></i> <?= lang('reset') ?></button>

                </div>

            </form>

            <a style="color:#fff;" href='<?= site_url('admin_payments') ?>'>
                <button class="btn btn-medium btn-danger">
                    <i class="icon icon-double-angle-left"></i> <?= lang('payments') ?></button>
            </a>
        </div>
    </div>

</div> <!--/content-->

<?php echo $footer; ?>
